package com.koron.order.common.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotBlank;

/**
 * @ClassName OrderCommonController
 * @description 前端统一调用接口, 由此转发请求到业务接口
 * @Author zhouj
 * @Date 2021/10/13 11:49
 */
@Slf4j
@Api(tags = "工单公共接口(暂定)", description = "前端统一调用接口, 由此转发请求到业务接口")
@Controller
@RequestMapping("/orderCommon/")
public class OrderCommonController {

    @ApiOperation(value = "保存执行信息")
    @PostMapping("execute/saveExecuteInfo")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderType", value = "工单类型", required = true, dataType = "String")
    })
    public String saveExecuteInfo(@NotBlank @RequestParam String orderType) {
        return "forward:/" + orderType + "/execute/saveExecuteInfo";
    }

    @ApiOperation(value = "orderId查询执行信息列表")
    @GetMapping("execute/queryExecuteInfoByOrderId")
    public String queryListByOrderId(@NotBlank @RequestParam String orderType) {
        return "forward:/" + orderType + "/execute/queryExecuteInfoByOrderId";
    }

    @ApiOperation(value = "executeId查询执行信息")
    @GetMapping("execute/queryExecuteInfoByExecuteId")
    public String queryExecuteInfoByExecuteId(@NotBlank @RequestParam String orderType) {
        return "forward:/" + orderType + "/execute/queryExecuteInfoByExecuteId";
    }

    @ApiOperation(value = "executeId删除执行信息")
    @DeleteMapping("execute/deleteExecuteInfoByExecuteId")
    public String deleteExecuteInfoByExecuteId(@NotBlank @RequestParam String orderType) {
        return "forward:/" + orderType + "/execute/deleteExecuteInfoByExecuteId";
    }

    @ApiOperation(value = "orderId查询派工信息")
    @GetMapping("dispatch/queryDispatchInfoByOrderId")
    public String queryDispatchListByOrderId(@NotBlank @RequestParam String orderType) {
        return "forward:/" + orderType + "/dispatch/queryDispatchInfoByOrderId";
    }

    @ApiOperation(value = "保存派工信息")
    @PostMapping("dispatch/saveDispatchInfo")
    public String saveDispatchInfo(@NotBlank @RequestParam String orderType) {
        return "forward:/" + orderType + "/dispatch/saveDispatchInfo";
    }

    @ApiOperation(value = "删除派工信息")
    @DeleteMapping("dispatch/deleteDispatchInfo")
    public String deleteDispatchInfo(@NotBlank @RequestParam String orderType) {
        return "forward:/" + orderType + "/dispatch/deleteDispatchInfo";
    }

    @ApiOperation(value = "orderId查询可提交人员列表")
    @GetMapping("querySubmitUserListByOrderId")
    public String querySubmitUserListByOrderId(@NotBlank @RequestParam String orderId) {
        return "forward:/orderExecute/querySubmitUserListByOrderId";
    }

    @ApiOperation(value = "新增 ")
    @PostMapping("saveAcceptInfo")
    public String saveAcceptInfo(@NotBlank @RequestParam String orderType) {
        return "forward:/" + orderType + "/orderAccept/saveAcceptInfo";
    }

    @ApiOperation(value = "新增分析报告")
    @PostMapping("saveReportInfo")
    public String saveReportInfo(@NotBlank @RequestParam String orderType) {
        return "forward:/" + orderType + "/orderAccept/saveReportInfo";
    }

}
